package app.r_teenus.backend.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name = "SERVICE_PART")
public class ServicePart implements Serializable {

	private static final long serialVersionUID = 1339723366286801853L;
	private Integer id = null;
	private String name = null;
	private Double price = null;
	private Integer count = null;
	private Integer createdBy = null;
	private Date created = null;
	private String serialNo = null;
	private ServiceOrder serviceOrder = null;
	private ServiceDevice serviceDevice = null;

	/**
	 * Gets id (primary key).
	 */
	@Id
	@Column(name = "SERVICE_PART")
	@SequenceGenerator(name = "service_part_id", sequenceName = "service_part_id", allocationSize = 1)
	@GeneratedValue(generator = "service_part_id")
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "PART_NAME")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "PART_PRICE")
	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	@Column(name = "PART_COUNT")
	public Integer getCount() {
		return count;
	}

	public void setCount(Integer count) {
		this.count = count;
	}

	@Column(name = "CREATED_BY")
	public Integer getCreatedBy() {
		return createdBy;
	}

	public void setCreatedBy(Integer createdBy) {
		this.createdBy = createdBy;
	}

	public Date getCreated() {
		return created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

	@Column(name = "SERIAL_NO")
	public String getSerialNo() {
		return serialNo;
	}

	public void setSerialNo(String serialNo) {
		this.serialNo = serialNo;
	}

	@OneToOne
	@JoinColumn(name = "SERVICE_ORDER_FK", nullable = false)
	public ServiceOrder getServiceOrder() {
		return serviceOrder;
	}

	public void setServiceOrder(ServiceOrder serviceOrder) {
		this.serviceOrder = serviceOrder;
	}

	@OneToOne
	@JoinColumn(name = "SERVICE_DEVICE_FK", nullable = false)
	public ServiceDevice getServiceDevice() {
		return serviceDevice;
	}

	public void setServiceDevice(ServiceDevice serviceDevice) {
		this.serviceDevice = serviceDevice;
	}
}
